﻿@using SimpleIdServer.FastFed.ApplicationProvider.Startup.Resources
@using SimpleIdServer.FastFed.Models
@model IEnumerable<SimpleIdServer.FastFed.ApplicationProvider.UIs.ViewModels.IdentityProviderViewModel>

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = IdentityProvidersResource.IdentityProviders;
}

<h3>@IdentityProvidersResource.IdentityProviders</h3>

<div class="card">
    <div class="card-body">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>@IdentityProvidersResource.EntityId</th>
                    <th>@IdentityProvidersResource.CreateDateTime</th>
                    <th>@IdentityProvidersResource.Status</th>
                    <th>@IdentityProvidersResource.ExpirationTime</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var identityProvider in Model)
                {
                    <tr>
                        <td><a href="@Url.Action("View", "IdentityProviders", new { entityId = identityProvider.EntityId })">@identityProvider.EntityId</a></td>
                        <td>@identityProvider.CreateDateTime.ToString()</td>
                        <td>
                            @if (identityProvider.Status != null)
                            {
                                <span>@Enum.GetName(typeof(IdentityProviderStatus), identityProvider.Status.Value)</span>
                            }
                        </td>
                        <td>
                            @if (identityProvider.ExpirationTime != null && identityProvider.Status == IdentityProviderStatus.WHITELISTED)
                            {
                                <label>@DateTimeOffset.FromUnixTimeSeconds((long)identityProvider.ExpirationTime.Value).ToString()</label>
                            }
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>